// 获取强度节点
const tension_box = document.querySelectorAll(".tension")
console.log(tension_box[0])
//获取输入框节点
const input_box = document.querySelectorAll(".input")

//绑定事件
window.addEventListener("keyup",function(evt){
    let target = evt.target
   if(target.className == "input"){
    let text = target.value

    //判断密码强度
    let regex1 = /\d/;
    let regex2 = /[a-z]/i
    let regex3 = /[/*-.=+@#$%^&()?><{}|":'~`]/

    let level = 0
    if(regex1.test(text)) level++
    if(regex2.test(text)) level++
    if(regex3.test(text)) level++
    console.log(level)

    tension_box[0].classList.remove("color1")
    tension_box[1].classList.remove("color2")
    tension_box[2].classList.remove("color3")
    if(level == 1){
        tension_box[0].classList.add("color1")
    }
    if(level == 2){
        tension_box[1].classList.add("color2")
    }
    if(level == 3){
        tension_box[2].classList.add("color3")
    }
   }
    
})